package com.ideaaedi.zoo.diy.feature.msg.api.mq.core;

import com.ideaaedi.zoo.diy.feature.msg.api.exception.MqSendWayUnsupportException;
import com.ideaaedi.zoo.diy.feature.msg.api.mq.entity.MqSendOption;
import com.ideaaedi.zoo.diy.feature.msg.api.mq.entity.MqSendResult;
import com.ideaaedi.zoo.diy.feature.msg.api.msg.MsgSender;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * 队列消息发送器
 *
 * @author <font size = "20" color = "#3CAA3C"><a href="https://gitee.com/JustryDeng">JustryDeng</a></font> <img
 * src="https://gitee.com/JustryDeng/shared-files/raw/master/JustryDeng/avatar.jpg" />
 * @since 1.0.0
 */
public interface MqSender extends MsgSender {
    
    /**
     * 发送mq消息
     *
     * @param channel 信道
     * @param data 数据
     *
     * @return 发送结果
     */
    default MqSendResult send(@Nonnull String channel, @Nonnull Object data) {
        return send(channel, data, null);
    }
    
    /**
     * 发送mq消息
     *
     * @param channel 信道
     * @param data 数据
     * @param option 其余参数
     *
     * @return 发送结果
     */
    default MqSendResult send(@Nonnull String channel, @Nonnull Object data, @Nullable MqSendOption option) {
        throw new MqSendWayUnsupportException(this.getClass().getName() + " not support send(String, Object, MqSendOption)");
    }
}
